
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/polys/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:25:34 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Polynomial Manipulation &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="index.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Basic functionality of the module" href="basics.html" />
    <link rel="prev" title="Plotting" href="../plotting.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="basics.html" title="Basic functionality of the module"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../plotting.html" title="Plotting"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Polynomial Manipulation</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="polynomial-manipulation">
<span id="polys-docs"></span><h1>Polynomial Manipulation<a class="headerlink" href="#polynomial-manipulation" title="Permalink to this headline">¶</a></h1>
<p>Computations with polynomials are at the core of computer algebra and
having a fast and robust polynomials manipulation module is a key for
building a powerful symbolic manipulation system. SymPy has a dedicated
module <a class="reference internal" href="reference.html#module-sympy.polys" title="sympy.polys"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sympy.polys</span></code></a> for computing in polynomial algebras over
various coefficient domains.</p>
<p>There is a vast number of methods implemented, ranging from simple tools
like polynomial division, to advanced concepts including Gröbner bases
and multivariate factorization over algebraic number domains.</p>
<section id="contents">
<h2>Contents<a class="headerlink" href="#contents" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="basics.html">Basic functionality of the module</a><ul>
<li class="toctree-l2"><a class="reference internal" href="basics.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="basics.html#basic-concepts">Basic concepts</a><ul>
<li class="toctree-l3"><a class="reference internal" href="basics.html#polynomials">Polynomials</a></li>
<li class="toctree-l3"><a class="reference internal" href="basics.html#divisibility">Divisibility</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="basics.html#basic-functionality">Basic functionality</a><ul>
<li class="toctree-l3"><a class="reference internal" href="basics.html#division">Division</a></li>
<li class="toctree-l3"><a class="reference internal" href="basics.html#gcd-and-lcm">GCD and LCM</a></li>
<li class="toctree-l3"><a class="reference internal" href="basics.html#square-free-factorization">Square-free factorization</a></li>
<li class="toctree-l3"><a class="reference internal" href="basics.html#factorization">Factorization</a></li>
<li class="toctree-l3"><a class="reference internal" href="basics.html#groebner-bases">Groebner bases</a></li>
<li class="toctree-l3"><a class="reference internal" href="basics.html#solving-equations">Solving Equations</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="wester.html">Examples from Wester’s Article</a><ul>
<li class="toctree-l2"><a class="reference internal" href="wester.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="wester.html#examples">Examples</a><ul>
<li class="toctree-l3"><a class="reference internal" href="wester.html#simple-univariate-polynomial-factorization">Simple univariate polynomial factorization</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#univariate-gcd-resultant-and-factorization">Univariate GCD, resultant and factorization</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#multivariate-gcd-and-factorization">Multivariate GCD and factorization</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#support-for-symbols-in-exponents">Support for symbols in exponents</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#testing-if-polynomials-have-common-zeros">Testing if polynomials have common zeros</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#normalizing-simple-rational-functions">Normalizing simple rational functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#expanding-expressions-and-factoring-back">Expanding expressions and factoring back</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#factoring-in-terms-of-cyclotomic-polynomials">Factoring in terms of cyclotomic polynomials</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#univariate-factoring-over-gaussian-numbers">Univariate factoring over Gaussian numbers</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#computing-with-automatic-field-extensions">Computing with automatic field extensions</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#univariate-factoring-over-various-domains">Univariate factoring over various domains</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#factoring-polynomials-into-linear-factors">Factoring polynomials into linear factors</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#advanced-factoring-over-finite-fields">Advanced factoring over finite fields</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#working-with-expressions-as-polynomials">Working with expressions as polynomials</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#computing-reduced-grobner-bases">Computing reduced Gröbner bases</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#multivariate-factoring-over-algebraic-numbers">Multivariate factoring over algebraic numbers</a></li>
<li class="toctree-l3"><a class="reference internal" href="wester.html#partial-fraction-decomposition">Partial fraction decomposition</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="wester.html#literature">Literature</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="reference.html">Polynomials Manipulation Module Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="reference.html#basic-polynomial-manipulation-functions">Basic polynomial manipulation functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#extra-polynomial-manipulation-functions">Extra polynomial manipulation functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#domain-constructors">Domain constructors</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#algebraic-number-fields">Algebraic number fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#monomials-encoded-as-tuples">Monomials encoded as tuples</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#orderings-of-monomials">Orderings of monomials</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#formal-manipulation-of-roots-of-polynomials">Formal manipulation of roots of polynomials</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#symbolic-root-finding-algorithms">Symbolic root-finding algorithms</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#special-polynomials">Special polynomials</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#orthogonal-polynomials">Orthogonal polynomials</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#manipulation-of-rational-functions">Manipulation of rational functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#partial-fraction-decomposition">Partial fraction decomposition</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#dispersion-of-polynomials">Dispersion of Polynomials</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="agca.html">AGCA - Algebraic Geometry and Commutative Algebra Module</a><ul>
<li class="toctree-l2"><a class="reference internal" href="agca.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="agca.html#reference">Reference</a><ul>
<li class="toctree-l3"><a class="reference internal" href="agca.html#base-rings">Base Rings</a></li>
<li class="toctree-l3"><a class="reference internal" href="agca.html#modules-ideals-and-their-elementary-properties">Modules, Ideals and their Elementary Properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="agca.html#module-homomorphisms-and-syzygies">Module Homomorphisms and Syzygies</a></li>
<li class="toctree-l3"><a class="reference internal" href="agca.html#finite-extensions">Finite Extensions</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="domainsintro.html">Introducing the Domains of the poly module</a><ul>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#what-are-the-domains">What are the domains?</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#representing-expressions-symbolically">Representing expressions symbolically</a><ul>
<li class="toctree-l3"><a class="reference internal" href="domainsintro.html#tree-representation">Tree representation</a></li>
<li class="toctree-l3"><a class="reference internal" href="domainsintro.html#dup-representation">DUP representation</a></li>
<li class="toctree-l3"><a class="reference internal" href="domainsintro.html#dmp-representation">DMP representation</a></li>
<li class="toctree-l3"><a class="reference internal" href="domainsintro.html#sparse-polynomial-representation">Sparse polynomial representation</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#basic-usage-of-domains">Basic usage of domains</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#domain-elements-vs-sympy-expressions">Domain elements vs sympy expressions</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#gaussian-integers-and-gaussian-rationals">Gaussian integers and Gaussian rationals</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#finite-fields">Finite fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#real-and-complex-fields">Real and complex fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#algebraic-number-fields">Algebraic number fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#polynomial-ring-domains">Polynomial ring domains</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#old-dense-polynomial-rings">Old (dense) polynomial rings</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#polyring-vs-polynomialring">PolyRing vs PolynomialRing</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#rational-function-fields">Rational function fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#expression-domain">Expression domain</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#choosing-a-domain">Choosing a domain</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#converting-elements-between-different-domains">Converting elements between different domains</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#unifying-domains">Unifying domains</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#internals-of-a-poly">Internals of a Poly</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#choosing-a-domain-for-a-poly">Choosing a domain for a Poly</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#choosing-generators">Choosing generators</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsintro.html#algebraically-dependent-generators">Algebraically dependent generators</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="domainsref.html">Reference docs for the Poly Domains</a><ul>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#domains">Domains</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#abstract-domains">Abstract Domains</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#gf-p">GF(p)</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#zz">ZZ</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#qq">QQ</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#mpq">MPQ</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#gaussian-domains">Gaussian domains</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#zz-i">ZZ_I</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#qq-i">QQ_I</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#qq-a">QQ&lt;a&gt;</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#rr">RR</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#cc">CC</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#k-x">K[x]</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#id11">K(x)</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#ex">EX</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#quotient-ring">Quotient ring</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#sparse-polynomials">Sparse polynomials</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#sparse-rational-functions">Sparse rational functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainsref.html#dense-polynomials">Dense polynomials</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="internals.html">Internals of the Polynomial Manipulation Module</a><ul>
<li class="toctree-l2"><a class="reference internal" href="internals.html#level-zero">Level Zero</a><ul>
<li class="toctree-l3"><a class="reference internal" href="internals.html#manipulation-of-dense-multivariate-polynomials">Manipulation of dense, multivariate polynomials</a></li>
<li class="toctree-l3"><a class="reference internal" href="internals.html#manipulation-of-dense-univariate-polynomials-with-finite-field-coefficients">Manipulation of dense, univariate polynomials with finite field coefficients</a></li>
<li class="toctree-l3"><a class="reference internal" href="internals.html#manipulation-of-sparse-distributed-polynomials-and-vectors">Manipulation of sparse, distributed polynomials and vectors</a></li>
<li class="toctree-l3"><a class="reference internal" href="internals.html#polynomial-factorization-algorithms">Polynomial factorization algorithms</a></li>
<li class="toctree-l3"><a class="reference internal" href="internals.html#groebner-basis-algorithms">Groebner basis algorithms</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="internals.html#module-sympy.polys.polyoptions">Options</a></li>
<li class="toctree-l2"><a class="reference internal" href="internals.html#module-sympy.polys.polyconfig">Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="internals.html#exceptions">Exceptions</a></li>
<li class="toctree-l2"><a class="reference internal" href="internals.html#reference">Reference</a><ul>
<li class="toctree-l3"><a class="reference internal" href="internals.html#modular-gcd">Modular GCD</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="internals.html#undocumented">Undocumented</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="ringseries.html">Series Manipulation using Polynomials</a><ul>
<li class="toctree-l2"><a class="reference internal" href="ringseries.html#rs-series">rs_series</a></li>
<li class="toctree-l2"><a class="reference internal" href="ringseries.html#contribute">Contribute</a><ul>
<li class="toctree-l3"><a class="reference internal" href="ringseries.html#manipulation-of-power-series">Manipulation of power series</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="literature.html">Literature</a></li>
<li class="toctree-l1"><a class="reference internal" href="solvers.html">Poly solvers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="solvers.html#solve-lin-sys">solve_lin_sys</a></li>
<li class="toctree-l2"><a class="reference internal" href="solvers.html#eqs-to-matrix">eqs_to_matrix</a></li>
<li class="toctree-l2"><a class="reference internal" href="solvers.html#sympy-eqs-to-ring">sympy_eqs_to_ring</a></li>
<li class="toctree-l2"><a class="reference internal" href="solvers.html#id1">_solve_lin_sys</a></li>
<li class="toctree-l2"><a class="reference internal" href="solvers.html#solve-lin-sys-component">_solve_lin_sys_component</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="domainmatrix.html">Introducing the domainmatrix of the poly module</a><ul>
<li class="toctree-l2"><a class="reference internal" href="domainmatrix.html#what-is-domainmatrix">What is domainmatrix?</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainmatrix.html#domainmatrix-class-reference">DomainMatrix Class Reference</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainmatrix.html#ddm-class-reference">DDM Class Reference</a></li>
<li class="toctree-l2"><a class="reference internal" href="domainmatrix.html#sdm-class-reference">SDM Class Reference</a></li>
</ul>
</li>
</ul>
</div>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Polynomial Manipulation</a><ul>
<li><a class="reference internal" href="#contents">Contents</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../plotting.html"
                        title="previous chapter">Plotting</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="basics.html"
                        title="next chapter">Basic functionality of the module</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/polys/index.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="basics.html" title="Basic functionality of the module"
             >next</a> |</li>
        <li class="right" >
          <a href="../plotting.html" title="Plotting"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Polynomial Manipulation</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/polys/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:25:37 GMT -->
</html>